package com.ayoka.ui.mine.collection;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.ayoka.R;
import com.ayoka.adapter.CommonPagerAdapter;
import com.ayoka.base.BaseActivity;
import com.ayoka.base.BasePresenter;
import com.ayoka.databinding.ActivityCollectionBinding;
import com.jcp.baselibrary.model.ToolBarOptions;

/**
 * @author jcp
 * @ClassName: TopicListActivity
 * @Description:
 * @date 2018-12-28 下午4:21:18
 */
public class CollectionActivity extends BaseActivity<ActivityCollectionBinding, BasePresenter> {

    public static void start(Activity activity) {
        Intent intent = new Intent(activity, CollectionActivity.class);
        activity.startActivity(intent);
    }

    private CommonPagerAdapter collectionPageAdapter;

    @Override
    public int getContentLayout() {
        return R.layout.activity_collection;
    }


    @Override
    protected void initViews() {
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        ToolBarOptions options = new ToolBarOptions(R.string.favorite);
        setCustomToolBar(mDataBinding.customToolbar.toolbar, options);

        configFragmentViewPager();
    }

    private void configFragmentViewPager() {
        collectionPageAdapter = new CommonPagerAdapter(getSupportFragmentManager());
        CollectionCourseFragment courseFragment = CollectionCourseFragment.newInstance();
        collectionPageAdapter.addFragment(courseFragment, getString(R.string.course));
        CollectionMeditationFragment meditationFragment = CollectionMeditationFragment.newInstance();
        collectionPageAdapter.addFragment(meditationFragment, getString(R.string.training));
        mDataBinding.viewpager.setAdapter(collectionPageAdapter);
        mDataBinding.viewpager.setOffscreenPageLimit(2);
        mDataBinding.tabsCollection.setupWithViewPager(mDataBinding.viewpager);
    }

    @Override
    protected BasePresenter getPresenter() {
        return null;
    }
}
